package com.derbysoft.defender.api.response;

import java.io.Serializable;
import java.util.Date;

/**
 * <pre>
 * {
 * "access_token":"8b930825-644f-455b-a1d2-acd790417ef8",
 * "token_type":"bearer",
 * "refresh_token":"4b148e55-e9ea-408f-89df-ba15158517e8",
 * "expires_in":322,
 * "scope":"read write"
 * }
 * </pre>
 */
public class OAuth2AccessToken implements Serializable {
    private static final long serialVersionUID = 1265612698155191L;

    private String access_token;
    private String token_type;
    private String refresh_token;
    private Integer expires_in;
    private String scope;
    private Date expires;

    public String getAccess_token() {
        return access_token;
    }

    public void setAccess_token(String access_token) {
        this.access_token = access_token;
    }

    public String getToken_type() {
        return token_type;
    }

    public void setToken_type(String token_type) {
        this.token_type = token_type;
    }

    public String getRefresh_token() {
        return refresh_token;
    }

    public void setRefresh_token(String refresh_token) {
        this.refresh_token = refresh_token;
    }

    public Integer getExpires_in() {
        return expires_in;
    }

    public void setExpires_in(Integer expires_in) {
        this.expires_in = expires_in;
    }

    public String getScope() {
        return scope;
    }

    public void setScope(String scope) {
        this.scope = scope;
    }

    public Date getExpires() {
        return expires;
    }

    public void setExpires(Date expires) {
        this.expires = expires;
    }

    public OAuth2AccessToken initExpires() {
        this.expires = new Date(System.currentTimeMillis() + expires_in * 1000);
        return this;
    }
}
